﻿// See https://aka.ms/new-console-template for more information
using Microsoft.Extensions.DependencyInjection;
using ConsoleApp3;

Console.WriteLine("Hello, World!");

var serviceProvider = new ServiceCollection()
                .AddSingleton<IEventBus, EventBus>()
                .AddTransient<SomeService>()
                .BuildServiceProvider();

var eventBus = serviceProvider.GetService<IEventBus>();
if (eventBus != null)
{
    var someService = serviceProvider.GetRequiredService<SomeService>();
    someService.DoSomething();
}